<?php
namespace Zxf5115\Laravel\Advertising\Controllers\Api;

use Zxf5115\Laravel\Kernel\Controllers\Api\ApiController;

/**
 * @author zhangxiaofei [<1326336909@qq.com>]
 * @dateTime 2025-09-17
 *
 * 接口广告控制器类
 */
class AdvertisingController extends ApiController
{
  /**
   * 允许客户端查询的字段
   */
  protected array $allowParams = [
    'organization_id',
    'position_id',
    'status',
    'create_time',
  ];

  /**
   * 关键字查询配置
   */
  protected array $allowKeywordParams = [
    'receive' => 'keyword',
    'match' => [
      'id',
      'position_id',
      'title',
    ]
  ];

  /**
   * 关联查询配置
   */
  protected array $allowRelationParams = [
    'position' => [
      'title',
    ]
  ];

  /**
   * 查询字段配置
   */
  public array $fieldParams = [
    'select' => [
      'id', 'title', 'picture'
    ],
    'view' => [
      'id', 'title', 'create_time'
    ]
  ];

  /**
   * 排序规则
   */
  protected array $sortRules = [
    ['key' => 'sort', 'value' => 'desc'],
    ['key' => 'id', 'value' => 'desc'],
    ['key' => 'create_time', 'value' => 'desc'],
  ];

  /**
   * 关联预加载配置
   */
  protected array $withRelations = [
    'view' => ['detail']
  ];
}
